using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WebServiceTI.Client
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

    

        private void taskBindingSource_CurrentChanged(object sender, EventArgs e)
        {

        }

        private TaskServer.Task ReadTask()
        {
            TaskServer.Task task = new WebServiceTI.Client.TaskServer.Task();
            task.Owner = new WebServiceTI.Client.TaskServer.PersonalData();
            task.Owner.First_name = textName.Text;
            task.Owner.Last_name = textLastName.Text;
            task.Name = textTaskName.Text;
            task.Descryption = textDescryption.Text;
            return task;
        }

        private void downloadBtn_Click(object sender, EventArgs e)
        {
            TaskServer.TaskManagerClient client = new WebServiceTI.Client.TaskServer.TaskManagerClient();
            taskBindingSource.DataSource = client.GetTaskList();

            taskGridView.Refresh(); 
        }

        private void addBtn_Click(object sender, EventArgs e)
        {
            TaskServer.TaskManagerClient client = new WebServiceTI.Client.TaskServer.TaskManagerClient();
           
          
            client.AddTask(ReadTask());
        }
    }
}